# -*- coding: utf-8 -*-

# Created on 06/08/2010

# Copyright (C) 2010  Sergio Rodrigo

# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.

# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.

# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.


STATE_NONE = 0    ## Cambiar por "en reposo"
STATE_PRESSED = 1
STATE_RELEASED = 2

class Component:
    """ Component of a peripheral.
    
    * Methods:
    __init__(self, name="", value=None, magnitude=0.0)
    update(self, event) -- Must be overriden
    
    * Member variables:
    name -- String name of the component
    value -- Integer value of the component
    magnitude -- Float magnitude of the component actions
    currentState -- Integer state of the component
    
    Must be subclassed.
    
    """

    def __init__(self, name, value, magnitude):
        """ Constructor.
        
        * Arguments:
        name -- String name of the component (default "")
        value -- Integer value of the component (default None)
        magnitude -- Float magnitude of the component actions (default 0.0)
        
        """
        self.name = name
        self.currentState = STATE_NONE
        self.value = value;
        self.magnitude = magnitude;

    def update(self, event):
        """ Updates the state of the component.
        
        * Arguments:
        event -- A pygame event (default None)
        
        Must be overriden.
        
        """
        NotImplementedError

# eof
